<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表</title>
</head>
<body>
<h1>员工列表2</h1>
<table border="1">
    <caption>员工信息2</caption>
    <tr>
        <th>id</th><th>名字</th><th>工作</th><th>工资</th>
    </tr>
    <tr v-for="emp in arr">
        <td>{{emp.id}}</td><td>{{emp.name}}</td><td>{{emp.job}}</td><td>{{emp.sal}}</td>
    </tr>
</table>
<!--引入vue和axios-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
    let v = new Vue({
        el:"table",
        data:{
            arr:[]
        },
        created:function () {
            axios.get("/select2").then(function (response) {
                v.arr=response.data;
            })
        }
    })
</script>
</body>
</html>